package com.wisely.highlight_spring4.ch3.conditional;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName ConditionConfig
 * @Package com.wisely.highlight_spring4.ch3.conditional
 * @Description TODO
 * @Author zjb
 * @Date 2018/7/23 11:46
 * @Version 1.0
 **/
@Configuration
public class ConditionConfig {
    @Bean
    //通过@Conditional注解，符合Windows条件则实例化windowsListService
    @Conditional(WindowsCondition.class)
    public ListService windowsListService(){
        return new WindowsListService();
    }
    @Bean
    //通过@Conditional注解，符合Linux条件则实例化linuxListService
    @Conditional(LinuxCondition.class)
    public  ListService linuxListService(){
        return new LinuxListService();
    }


}
